import sys
import os

# 若文件扩展名为 .py 等源码，filen为python解释器路径
# 若文件扩展名为 .exe，filen为文件自身路径
filen = sys.executable
# 列出解释器可能的名称
interpreter_name = ['python.exe','pypy.exe','pythonw.exe','pypyw.exe']

if filen.split('\\')[-1] in interpreter_name:
    ext = 'py'
else:
    ext = 'exe'

if ext == 'exe':
    iniFile = os.path.join(os.path.dirname(os.path.abspath(filen)), 'Config.ini')
elif ext == 'py':
    iniFile = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'Config.ini')

print(filen)
print(iniFile)
print(__file__)